<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Fit Layout</title>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
    <script src="../../../../scripts/jquery.min.js"></script>
    <script src="../../../../scripts/miniui/miniui.js"></script>
    <link href="../../../../scripts/miniui/themes/default/miniui.css" rel="stylesheet">
    <link href="../../../../scripts/miniui/themes/icons.css" rel="stylesheet">
    <link href="../../../../scripts/miniui/themes/pure/skin.css" rel="stylesheet">
    <script src="../../../../scripts/core.js"></script>

</head>
<body>
<style type="text/css">
    html, body {
        margin: 0;
        padding: 0;
        border: 0;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }
</style>
<div class="mini-toolbar" style="padding:2px;border-bottom:0;">
    <table style="width:100%;">
        <tr>
            <td>
                物品来源:
                <input class="mini-combobox" id="itemSource" showNullItem="true"
                       style="width:150px;"
                       textField="name"
                       valueField="id"/>
            </td>
            <td style="white-space:nowrap;">
                <input class="mini-textbox" emptyText="关键字" id="key" onenter="onKeyEnter" style="width:150px;"/>
                <a class="mini-button" onclick="search()">查询</a>
            </td>
        </tr>

    </table>
</div>
<!--撑满页面-->
<div class="mini-fit">

    <mini-datagrid _dataField="data111" allowCellEdit="true" allowCellSelect="true"
                   allowResize="true" allowSortColumn="false"
                   class="mini-datagrid"
                   id="datagrid1" idField="id" multiSelect="true"
                   pageSize="1000" showSortIcon="true"
                   style="width:100%;height:100%;"
                   url="/item/getItemLogs">
        <columns>
            <column type="indexcolumn"></column>
            <column field="itemName" headerAlign="center" width="120">物品名称
            </column>
            <column field="addTypeName" width="100">类型

            </column>
            <column field="old" width="100">开始值

            </column>
            <column field="val" width="100">变更目标值
            </column>
            <column field="fail" width="100">失败值
            </column>
            <column field="current" width="100">变更后值

            </column>
            <column field="name" width="100">来源类型名称

            </column>
            <column dateFormat="yyyy-MM-dd HH:mm:ss" field="updateAt" width="100">创建时间

            </column>
            <column field="id" headerAlign="center" name="id" width="150">
                数据id
            </column>

        </columns>
    </mini-datagrid>

</div>

<script type="text/javascript">

    var auth = GetParams()
    mini.parse();
    var grid = mini.get("datagrid1");
    grid.setAjaxOptions({
        headers: {"authId": auth.authId, "token": auth.token}
    });

    // 页面完全加载完成（包括图片等资源）
    $(window).on("load", async function () {
        var zone = mini.get("itemSource");
        const tokenResp = await fetch("/item/getItemSource", {
            method: 'POST',
            headers: {"authId": auth.authId, "token": auth.token},
            contentType: 'application/json'
        });
        const sysResp = await tokenResp.json();
        zone.setData(sysResp)
    });

    function search() {
        var sourceId = mini.get("itemSource").getValue();
        var key = mini.get("key").getValue();
        grid.load({
            sourceId: sourceId,
            roleId: key
        });
    }


</script>

</body>
</html>